<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JavaScript</title>
</head>
<body>

    <input type="button" id="bth1" value="按纽一" onclick="fun1()">
    <input type="button" id="bth2" value="按纽二">
    
</body>
<script>
    function fun1(){
     alert("按钮一被点击");
    }
    document.getElementById("bth2").onclick=function(){
        alert("按钮2被点击");
    }
 </script>